package kii.events
{
	import flash.events.Event;
	import flash.events.IEventDispatcher;
	/**
	 * Pseudo abstract class for Events, contains some helper methods and properties. 
	 * @author Nirth
	 */
	public class KiiEvent extends Event
	{
		/**
		 * @inheritDoc
		 */
		public function KiiEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false)
		{
			super(type, bubbles, cancelable);
		}
		/**
		 * Reference to IEventDispatcher instance, shortcut for <code>event.target as IEventDispatcher</code>.
		 * @return 			Casted to <code>IEventDispatcher</code> reference to <code>Event.target</code>/
		 */
		public function get dispatcher():IEventDispatcher
		{
			return target as IEventDispatcher;
		}
		/**
		 * Removes event listener for current event.
		 * @param closure		Closure reference.
		 * @param useCapture	
		 */
		public function removeListener(closure:Function, useCapture:Boolean = false):void
		{
			dispatcher.removeEventListener(type, closure, useCapture);
		}
		/**
		 * @inheritDoc
		 */
		override public function toString():String
		{
			return formatToString('KiiEvent', 'type');
		}
	}
}